#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
@File    :   learn_match-case.py
@Time    :   2025/01/03 00:28:18
@Author  :   xiangyu Chen
@Version :   1.0
@Contact :   yu112yu@sina.com
@License :   (C)Copyright 2017-2018, Liugroup-NLPR-CASIA
@python_requires    :   >= 3.10
@Desc    :   match case ,在python3.10引入，可以匹配结构并析构：在匹配时解包和绑定变量
'''

import sys

MIN_PYTHON = (3, 10)
if sys.version_info < MIN_PYTHON:  # 低于要求时退出程序并打印： Python 版本必须大于等于 3.9
    sys.exit("match case需要Python 版本必须大于等于 {}.{}".format(*MIN_PYTHON))

'''
    #匹配字典时只要匹配一个Key即可，序列需要全部变量
def match_point(point: tuple):
    match points:
        case(0, 0):
            return "origin"
        case(0, y):
            return f"y-axis, y={y}"
        case(x, 0):
            return f"x-axis, x={x}"
        case(x, y):
            return f"({x}, {y})"
        case others:
            return "unknown point"
'''
